<script setup lang="ts">
import {useRouter} from 'vue-router'
const router=useRouter()
const propers=defineProps(['routes'])
const handleClick=(item:any)=>{
    console.log(item.path,'当前路径')
    router.push(item.path)
}
</script>
<template>
   <template v-for="item in propers.routes">
    <el-menu-item v-if="item.children==undefined" :index="item.index" @click="handleClick(item)">
        <el-icon size="20">
          <component :is="item.icon"></component>
        </el-icon>
        <span class="menu-font">{{ item.name }}</span>
    </el-menu-item>
    <el-sub-menu v-else :index="item.index">
      <template #title>
        <el-icon size="20">
          <component :is="item.icon"></component>
        </el-icon>
        <span class="menu-font">{{ item.name }}</span>
      </template>
      <menuTree :routes="item.children"/>
    </el-sub-menu>
   </template>
</template>
<style lang="scss">
.menu-font{
    font-weight:400;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
</style>